<template>
	<div>
		<div class="layout-breadcrumb">
			<Breadcrumb>
			    <BreadcrumbItem href="/">首页</BreadcrumbItem>
			    <BreadcrumbItem href="">系统配置</BreadcrumbItem>
			    <BreadcrumbItem href="">记录</BreadcrumbItem>
			    <BreadcrumbItem href="/config/record/sms">短信</BreadcrumbItem>
			</Breadcrumb>
		</div>
		<div class="layout-content">
		    <div class="layout-content-main">
		    	<Search  :callback="refreshTable"></Search>
		    	<BaseTable ref="table" :url="table.url" :header="table.header" ></BaseTable>
		    </div>
		</div>
	</div>
</template>
<script>
import Breadcrumb from 'iview/src/components/breadcrumb';
import Tag from 'iview/src/components/tag';
import BaseTable  from 'admin/components/table/base';
import Search  from 'admin/components/config/record/sms_search'

export default{
	components:{
        Breadcrumb,
        'BreadcrumbItem' : Breadcrumb.Item,
        BaseTable,
        Tag,
        Search
    },
    data () {
        return {
        	table:{
        		url : '/config/record/sms/view/list',
        		header: []
        	}
        }
    },
    methods:{
    	refreshTable(params){
    		this.$refs.table.tableData(params);
    	}
    },
    created:function(){
    	this.table.header =  [
            {
		        title: '手机号',
		        key: 'phone',
		        width : 110,
		    },
		    {
		        title: '发送时间',
		        key: 'created_at',
		        width : 150,
		    },
		    {
		        title: 'IP地址',
		        key: 'ip',
		      	width : 120,  
		    },
		    {
		        title: '发送状态',
		        key: 'statu',
		        width : 100,
		        render: (h, params) => {
		        	return h(Tag, {
                                props: {
                                    color: params.row.status==0 ? "blue" : "red"
                                }
                            }, params.row.status==0 ? '成功' : '失败');
                        
		        }
		    },
		    {
		        title: '返回错误码',
		        key: 'errorCode',
		        width : 100,
		    },
		    {
		        title: '返回错误说明',
		        key: 'errorReason',
		        width : 200,
		    },
		    {
		        title: '模版ID',
		        key: 'tpl_id',
		        width : 100,
		    },
		    {
		        title: '是否验证',
		        key: 'isCheck',
		        width : 100,
		        render: (h, params) => {
		        	return h(Tag, {
                                props: {
                                    color: params.row.isCheck ? "blue" : "red"
                                },
                                on: {
                                    
                                }
                            }, params.row.isCheck ? '是' : '否');
                        
		        }
		    },
		    {
		        title: '验证时间',
		        key: 'created_at',
		        width : 150,
		    },
		    {
		        title: '发送内容',
		        key: 'content',
		    },
		    {
		        title: '参数',
		        key: 'params',
		    },
        ];
    }
}
</script>